package com.tiger.cloud.enums;

import com.tiger.cloud.common.mybatis.handler.CodeEnum;

/**
 * 通用枚举类型
 */
public enum ActiveCountEnum implements CodeEnum<ActiveCountEnum> {

    ANDROID_COUNT(0, "安卓"), IOS_COUNT(1, "IOS"), PAGE_COUNT(2, "H5");

    private Integer code;
    private String desc;

    private ActiveCountEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 通过枚举<code>name</code>获取枚举
     */
    public static ActiveCountEnum getEnumByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ActiveCountEnum enumm : ActiveCountEnum.values()) {
            if (enumm.getCode() == code.intValue()) {
                return enumm;
            }
        }
        throw new IllegalArgumentException("AccountStatusEnum.不存在[" + code + "]对应的枚举值");
    }

    @Override
    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

}
